package com.ruoyi.common.utils;

import cn.hutool.core.util.ObjectUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

public class ListUtils {

    public static <T, R> List<R> listField(List<? extends T> beanList, Function<? super T, ? extends R> mapper) {
        if (ObjectUtil.isEmpty(beanList)) {
            return new ArrayList<>();
        }
        return beanList.stream().map(mapper).collect(Collectors.toList());
    }
}
